<!DOCTYPE html>



  




<html class="theme-next muse use-motion" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">
<meta name="baidu-site-verification" content="Hy7lziNO9f" />



  
  
    
    
  <script src="/lib/pace/pace.min.js?v=1.0.2"></script>
  <link href="/lib/pace/pace-theme-minimal.min.css?v=1.0.2" rel="stylesheet">







<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />





  <script>
  (function(i,s,o,g,r,a,m){i["DaoVoiceObject"]=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;a.charset="utf-8";m.parentNode.insertBefore(a,m)})(window,document,"script",('https:' == document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/0f81ff2f.js","daovoice")
  daovoice('init', {
      app_id: "fd041e6e"
    });
  daovoice('update');
  </script>














  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.4" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.4">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.4">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.4" color="#222">





  <meta name="keywords" content="Hexo, NexT" />





  <link rel="alternate" href="/atom.xml" title="Rsweater's Blog" type="application/atom+xml" />






<meta name="description" content="用Python实现经典统计分析中的相关分析，本文是ipynb转化生成jupyter notebook及Excel文件                 内容概述:  相关分析Spearman、Pearson系数的计算； 一元线性回归； 多元线性回归。  1 相关分析——Spearman、Pearson系数12345try:    import pandas as pd    import numpy">
<meta property="og:type" content="article">
<meta property="og:title" content="QG实验2-经典统计分析1">
<meta property="og:url" content="https://rsweater.github.io/2020/05/12/QG2-Classical_statistical_analysis/index.html">
<meta property="og:site_name" content="Rsweater&#39;s Blog">
<meta property="og:description" content="用Python实现经典统计分析中的相关分析，本文是ipynb转化生成jupyter notebook及Excel文件                 内容概述:  相关分析Spearman、Pearson系数的计算； 一元线性回归； 多元线性回归。  1 相关分析——Spearman、Pearson系数12345try:    import pandas as pd    import numpy">
<meta property="og:image" content="https://rsweater.github.io/.io//QG%E5%AE%9E%E9%AA%8C2-%E7%BB%8F%E5%85%B8%E7%BB%9F%E8%AE%A1%E5%88%86%E6%9E%901%EF%BC%88Excel%E3%80%81Python%29_19_1.svg">
<meta property="og:image" content="https://rsweater.github.io/.io//QG%E5%AE%9E%E9%AA%8C2-%E7%BB%8F%E5%85%B8%E7%BB%9F%E8%AE%A1%E5%88%86%E6%9E%901%EF%BC%88Excel%E3%80%81Python%29_21_1.svg">
<meta property="article:published_time" content="2020-05-12T10:38:07.000Z">
<meta property="article:modified_time" content="2020-05-13T11:09:26.330Z">
<meta property="article:author" content="一线毛衣">
<meta property="article:tag" content="Python GiS GDAL 爬虫 数据分析 机器学习">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://rsweater.github.io/.io//QG%E5%AE%9E%E9%AA%8C2-%E7%BB%8F%E5%85%B8%E7%BB%9F%E8%AE%A1%E5%88%86%E6%9E%901%EF%BC%88Excel%E3%80%81Python%29_19_1.svg">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Muse',
    version: '5.1.4',
    sidebar: {"position":"left","display":"post","offset":12,"b2t":true,"scrollpercent":true,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="https://Rsweater.github.io/2020/05/12/QG2-Classical_statistical_analysis/"/>





  <title>QG实验2-经典统计分析1 | Rsweater's Blog</title>
  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?e2c701b7194c8cece405996462a08694";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




<meta name="generator" content="Hexo 4.2.0"></head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <a href="https://github.com/rsweater" target="_blank" rel="noopener" class="github-corner" aria-label="View source on GitHub"><svg width="80" height="80" viewBox="0 0 250 250" style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">Rsweater's Blog</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <p class="site-subtitle">最好的状态来源于好的作息！最高的效率来源于好的资源配置！</p>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  <div class="popup search-popup local-search-popup">
  <div class="local-search-header clearfix">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
    <div class="local-search-input-wrapper">
      <input autocomplete="off"
             placeholder="搜索..." spellcheck="false"
             type="text" id="local-search-input">
    </div>
  </div>
  <div id="local-search-result"></div>
</div>



    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="https://Rsweater.github.io/2020/05/12/QG2-Classical_statistical_analysis/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="一线毛衣">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="Rsweater's Blog">
    </span>

    
      <header class="post-header">

        
        
          <h1 class="post-title" itemprop="name headline">QG实验2-经典统计分析1</h1>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2020-05-12T18:38:07+08:00">
                2020-05-12
              </time>
            

            

            
          </span>

          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2020/05/12/QG2-Classical_statistical_analysis/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count valine-comment-count" data-xid="/2020/05/12/QG2-Classical_statistical_analysis/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          

          
            <div class="post-wordcount">
              
                
                  <span class="post-meta-divider">|</span>
                
                <span class="post-meta-item-icon">
                  <i class="fa fa-file-word-o"></i>
                </span>
                
                <span title="字数统计">
                  5.1k
                </span>
              

              
                <span class="post-meta-divider">|</span>
              

              
                <span class="post-meta-item-icon">
                  <i class="fa fa-clock-o"></i>
                </span>
                
                <span title="阅读时长">
                  27
                </span>
              
            </div>
          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <p>用Python实现经典统计分析中的相关分析，本文是ipynb转化生成<br><a href="https://github.com/Rsweater/PythonGIS/tree/master/QG/QG%E5%AE%9E%E9%AA%8C2%E2%80%94%E2%80%94Python%E5%AE%9E%E7%8E%B0%E7%BB%8F%E5%85%B8%E7%BB%9F%E8%AE%A1%E5%88%86%E6%9E%901" target="_blank" rel="noopener">jupyter notebook及Excel文件</a>   </p>
<iframe src="https://nbviewer.jupyter.org/github/Rsweater/PythonGIS/blob/master/QG/QG%E5%AE%9E%E9%AA%8C2%E2%80%94%E2%80%94Python%E5%AE%9E%E7%8E%B0%E7%BB%8F%E5%85%B8%E7%BB%9F%E8%AE%A1%E5%88%86%E6%9E%901/QG%E5%AE%9E%E9%AA%8C2-%E7%BB%8F%E5%85%B8%E7%BB%9F%E8%AE%A1%E5%88%86%E6%9E%901%EF%BC%88Python%29.ipynb" name="menuFrame" id="menuFrame" onload="reinitIframe()" style="overflow:visible;" scrolling="no" height="100%" width="100%"> 
</iframe>










<p><strong>内容概述:</strong></p>
<ol>
<li>相关分析Spearman、Pearson系数的计算；</li>
<li>一元线性回归；</li>
<li>多元线性回归。</li>
</ol>
<h1 id="1-相关分析——Spearman、Pearson系数"><a href="#1-相关分析——Spearman、Pearson系数" class="headerlink" title="1 相关分析——Spearman、Pearson系数"></a>1 相关分析——Spearman、Pearson系数</h1><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">try</span>:</span><br><span class="line">    <span class="keyword">import</span> pandas <span class="keyword">as</span> pd</span><br><span class="line">    <span class="keyword">import</span> numpy <span class="keyword">as</span> np</span><br><span class="line"><span class="keyword">except</span>:</span><br><span class="line">    !pip3 install pandas numpy matplotlib</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">Data = &#123;</span><br><span class="line">    <span class="string">'平均气温x'</span>: [<span class="number">3.80</span>, <span class="number">4.00</span>, <span class="number">5.80</span>, <span class="number">8.00</span>, <span class="number">11.30</span>, <span class="number">14.40</span>, <span class="number">16.50</span>, <span class="number">16.20</span>, <span class="number">13.80</span>, <span class="number">10.80</span>, <span class="number">6.70</span>, <span class="number">4.70</span>],</span><br><span class="line">    <span class="string">'降雨量y'</span>: [<span class="number">77.70</span>, <span class="number">51.20</span>, <span class="number">60.10</span>, <span class="number">54.10</span>, <span class="number">55.40</span>, <span class="number">56.80</span>, <span class="number">45.00</span>, <span class="number">55.30</span>, <span class="number">67.50</span>, <span class="number">73.30</span>, <span class="number">76.60</span>, <span class="number">79.60</span>]</span><br><span class="line">&#125;</span><br><span class="line">data = pd.DataFrame(Data)</span><br><span class="line">data</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>平均气温x</th>
      <th>降雨量y</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>3.8</td>
      <td>77.7</td>
    </tr>
    <tr>
      <th>1</th>
      <td>4.0</td>
      <td>51.2</td>
    </tr>
    <tr>
      <th>2</th>
      <td>5.8</td>
      <td>60.1</td>
    </tr>
    <tr>
      <th>3</th>
      <td>8.0</td>
      <td>54.1</td>
    </tr>
    <tr>
      <th>4</th>
      <td>11.3</td>
      <td>55.4</td>
    </tr>
    <tr>
      <th>5</th>
      <td>14.4</td>
      <td>56.8</td>
    </tr>
    <tr>
      <th>6</th>
      <td>16.5</td>
      <td>45.0</td>
    </tr>
    <tr>
      <th>7</th>
      <td>16.2</td>
      <td>55.3</td>
    </tr>
    <tr>
      <th>8</th>
      <td>13.8</td>
      <td>67.5</td>
    </tr>
    <tr>
      <th>9</th>
      <td>10.8</td>
      <td>73.3</td>
    </tr>
    <tr>
      <th>10</th>
      <td>6.7</td>
      <td>76.6</td>
    </tr>
    <tr>
      <th>11</th>
      <td>4.7</td>
      <td>79.6</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># Pearson相关系数</span></span><br><span class="line">data.corr(<span class="string">'pearson'</span>)</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>平均气温x</th>
      <th>降雨量y</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>平均气温x</th>
      <td>1.000000</td>
      <td>-0.489495</td>
    </tr>
    <tr>
      <th>降雨量y</th>
      <td>-0.489495</td>
      <td>1.000000</td>
    </tr>
  </tbody>
</table>
</div>



<p><strong>Spearman相关系数看下面 2 pandas–read_excel最后。</strong><br>前面的部分是Python打开Excel常用的操作</p>
<h1 id="2-pandas——read-excel"><a href="#2-pandas——read-excel" class="headerlink" title="2 pandas——read_excel"></a>2 pandas——read_excel</h1><figure class="highlight plain"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">pandas.read_excel(io, sheet_name&#x3D;0, header&#x3D;0, names&#x3D;None, index_col&#x3D;None, usecols&#x3D;None, squeeze&#x3D;False, dtype&#x3D;None, engine&#x3D;None, converters&#x3D;None, true_values&#x3D;None, false_values&#x3D;None, skiprows&#x3D;None, nrows&#x3D;None, na_values&#x3D;None, keep_default_na&#x3D;True, verbose&#x3D;False, parse_dates&#x3D;False, date_parser&#x3D;None, thousands&#x3D;None, comment&#x3D;None, skipfooter&#x3D;0, convert_float&#x3D;True, mangle_dupe_cols&#x3D;True, **kwds)</span><br></pre></td></tr></table></figure>
<p>用途：Read an Excel file into a pandas DataFrame<br>支持格式：xls、xlsx、xlsm、xlsb和odf，可以是来自本地，也可以来自网络UR。<br>支持读入单个或多个工作表。   </p>
<p>API参考：<a href="https://pandas.pydata.org/docs/reference/api/pandas.read_excel.html#pandas.read_excel" target="_blank" rel="noopener">https://pandas.pydata.org/docs/reference/api/pandas.read_excel.html#pandas.read_excel</a></p>
<h2 id="2-1-数据准备"><a href="#2-1-数据准备" class="headerlink" title="2.1 数据准备"></a>2.1 数据准备</h2><pre><code>定位到工作表</code></pre><p><strong>内容：</strong>  </p>
<ol>
<li>路径io：接受任何的字符串路径，不论是本地的file还是其他的ftp、http、s3等等。</li>
<li>工作表sheet_name：接受 str、int、list，or None, defult 0<ol>
<li>字符串对应工作表名称；</li>
<li>整型对应工作表索引；</li>
<li>包含字符串或者整型的列表对应多个工作表；</li>
<li>None 表示解析所有工作表；</li>
</ol>
</li>
</ol>
<p> 注：如果使用解析多个工作表，将以字典的形式输出</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># sheet_name表明需要解析那张表格，默认为0（第一张）</span></span><br><span class="line">data1 = pd.read_excel(<span class="string">'/home/Ubuntu/Documents/test.xlsx'</span>, sheet_name=<span class="number">2</span>)</span><br><span class="line">data1</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>省市</th>
      <th>GDP(x)(亿元)</th>
      <th>GDP位次R1</th>
      <th>总人口(Y)(万人)</th>
      <th>总人口位次R2</th>
      <th>位次差的平方</th>
      <th>Unnamed: 6</th>
      <th>Unnamed: 7</th>
      <th>Unnamed: 8</th>
      <th>Unnamed: 9</th>
      <th>n</th>
      <th>显著水平α</th>
      <th>Unnamed: 12</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>广东</td>
      <td>13625.866128</td>
      <td>1.0</td>
      <td>7954.22</td>
      <td>4.0</td>
      <td>9</td>
      <td>NaN</td>
      <td>秩相关系数</td>
      <td>0.784677</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>0.050</td>
      <td>0.010</td>
    </tr>
    <tr>
      <th>1</th>
      <td>江苏</td>
      <td>12460.830000</td>
      <td>2.0</td>
      <td>7405.82</td>
      <td>5.0</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>4.0</td>
      <td>1.000</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>2</th>
      <td>山东</td>
      <td>12435.930000</td>
      <td>3.0</td>
      <td>9125.00</td>
      <td>2.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>5.0</td>
      <td>0.900</td>
      <td>1.000</td>
    </tr>
    <tr>
      <th>3</th>
      <td>浙江</td>
      <td>9395.000000</td>
      <td>4.0</td>
      <td>4679.55</td>
      <td>11.0</td>
      <td>49</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>6.0</td>
      <td>0.829</td>
      <td>0.943</td>
    </tr>
    <tr>
      <th>4</th>
      <td>河北</td>
      <td>7098.560000</td>
      <td>5.0</td>
      <td>6769.44</td>
      <td>6.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>7.0</td>
      <td>0.714</td>
      <td>0.893</td>
    </tr>
    <tr>
      <th>5</th>
      <td>河南</td>
      <td>7048.590000</td>
      <td>6.0</td>
      <td>9667.00</td>
      <td>1.0</td>
      <td>25</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>8.0</td>
      <td>0.643</td>
      <td>0.833</td>
    </tr>
    <tr>
      <th>6</th>
      <td>上海</td>
      <td>6250.810000</td>
      <td>7.0</td>
      <td>1711.00</td>
      <td>25.0</td>
      <td>324</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>9.0</td>
      <td>0.600</td>
      <td>0.783</td>
    </tr>
    <tr>
      <th>7</th>
      <td>辽宁</td>
      <td>6002.540000</td>
      <td>8.0</td>
      <td>4210.00</td>
      <td>14.0</td>
      <td>36</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>10.0</td>
      <td>0.564</td>
      <td>0.746</td>
    </tr>
    <tr>
      <th>8</th>
      <td>四川</td>
      <td>5456.320000</td>
      <td>9.0</td>
      <td>8700.40</td>
      <td>3.0</td>
      <td>36</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>12.0</td>
      <td>0.456</td>
      <td>0.712</td>
    </tr>
    <tr>
      <th>9</th>
      <td>湖北</td>
      <td>5401.710000</td>
      <td>10.0</td>
      <td>6001.70</td>
      <td>9.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>14.0</td>
      <td>0.456</td>
      <td>0.645</td>
    </tr>
    <tr>
      <th>10</th>
      <td>福建</td>
      <td>5232.170000</td>
      <td>11.0</td>
      <td>3488.00</td>
      <td>18.0</td>
      <td>49</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>16.0</td>
      <td>0.425</td>
      <td>0.601</td>
    </tr>
    <tr>
      <th>11</th>
      <td>湖南</td>
      <td>4638.730000</td>
      <td>12.0</td>
      <td>6662.80</td>
      <td>7.0</td>
      <td>25</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>18.0</td>
      <td>0.399</td>
      <td>0.564</td>
    </tr>
    <tr>
      <th>12</th>
      <td>黑龙江</td>
      <td>4430.000000</td>
      <td>13.0</td>
      <td>3815.00</td>
      <td>16.0</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>20.0</td>
      <td>0.377</td>
      <td>0.534</td>
    </tr>
    <tr>
      <th>13</th>
      <td>安徽</td>
      <td>3972.380000</td>
      <td>14.0</td>
      <td>6410.00</td>
      <td>8.0</td>
      <td>36</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>22.0</td>
      <td>0.359</td>
      <td>0.508</td>
    </tr>
    <tr>
      <th>14</th>
      <td>北京</td>
      <td>3663.100000</td>
      <td>15.0</td>
      <td>1456.40</td>
      <td>26.0</td>
      <td>121</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>24.0</td>
      <td>0.343</td>
      <td>0.485</td>
    </tr>
    <tr>
      <th>15</th>
      <td>江西</td>
      <td>2830.460000</td>
      <td>16.0</td>
      <td>4254.23</td>
      <td>13.0</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>26.0</td>
      <td>0.329</td>
      <td>0.465</td>
    </tr>
    <tr>
      <th>16</th>
      <td>广西</td>
      <td>2735.130000</td>
      <td>17.0</td>
      <td>4857.00</td>
      <td>10.0</td>
      <td>49</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>28.0</td>
      <td>0.317</td>
      <td>0.448</td>
    </tr>
    <tr>
      <th>17</th>
      <td>吉林</td>
      <td>2522.620000</td>
      <td>18.0</td>
      <td>2703.70</td>
      <td>21.0</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>30.0</td>
      <td>0.306</td>
      <td>0.432</td>
    </tr>
    <tr>
      <th>18</th>
      <td>云南</td>
      <td>2465.290000</td>
      <td>19.0</td>
      <td>4375.60</td>
      <td>12.0</td>
      <td>49</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>19</th>
      <td>山西</td>
      <td>2456.590000</td>
      <td>20.0</td>
      <td>3314.29</td>
      <td>19.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>20</th>
      <td>天津</td>
      <td>2447.660000</td>
      <td>21.0</td>
      <td>1011.30</td>
      <td>27.0</td>
      <td>36</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>21</th>
      <td>陕西</td>
      <td>2398.580000</td>
      <td>22.0</td>
      <td>3689.50</td>
      <td>17.0</td>
      <td>25</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>22</th>
      <td>重庆</td>
      <td>2250.560000</td>
      <td>23.0</td>
      <td>3130.00</td>
      <td>20.0</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>23</th>
      <td>内蒙古</td>
      <td>2150.414897</td>
      <td>24.0</td>
      <td>2379.61</td>
      <td>23.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>24</th>
      <td>新疆</td>
      <td>1877.610000</td>
      <td>25.0</td>
      <td>1933.95</td>
      <td>24.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>25</th>
      <td>贵州</td>
      <td>1356.110000</td>
      <td>26.0</td>
      <td>3869.66</td>
      <td>15.0</td>
      <td>121</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>26</th>
      <td>甘肃</td>
      <td>1304.600000</td>
      <td>27.0</td>
      <td>2603.34</td>
      <td>22.0</td>
      <td>25</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>27</th>
      <td>海南</td>
      <td>670.930000</td>
      <td>28.0</td>
      <td>810.52</td>
      <td>28.0</td>
      <td>0</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>28</th>
      <td>青海</td>
      <td>390.210000</td>
      <td>29.0</td>
      <td>533.80</td>
      <td>30.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>29</th>
      <td>宁夏</td>
      <td>385.340000</td>
      <td>30.0</td>
      <td>580.30</td>
      <td>29.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>30</th>
      <td>西藏</td>
      <td>184.500000</td>
      <td>31.0</td>
      <td>270.17</td>
      <td>31.0</td>
      <td>0</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>31</th>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>1068</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>



<p><strong>内容：</strong><br>   3. 列标签header: 默认defult 0，可以接受一个整数或者一个整数列表，整数所在的行作为列标签，整数列表则是表示多重标签。如果不需要列名，使用None。<br>   4. 自定义列名names:<br>      1. 基于header的基础上，接收列表，定义列名；<br>      2. 不能与header=None同时使用；<br>      3. names的长度必须和Excel列长度一致。<br>   5. 行标签index_col: 与header类似。<br>   6. 强制规定列数据类型converters，传入字典{列：类型}，dtype类似。</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 列标签header</span></span><br><span class="line">data2 = pd.read_excel(<span class="string">'/home/Ubuntu/Documents/test.xlsx'</span>, <span class="number">2</span>, header=<span class="literal">None</span>)</span><br><span class="line">data2</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
      <th>4</th>
      <th>5</th>
      <th>6</th>
      <th>7</th>
      <th>8</th>
      <th>9</th>
      <th>10</th>
      <th>11</th>
      <th>12</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>省市</td>
      <td>GDP(x)(亿元)</td>
      <td>GDP位次R1</td>
      <td>总人口(Y)(万人)</td>
      <td>总人口位次R2</td>
      <td>位次差的平方</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>n</td>
      <td>显著水平α</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>1</th>
      <td>广东</td>
      <td>13625.9</td>
      <td>1</td>
      <td>7954.22</td>
      <td>4</td>
      <td>9</td>
      <td>NaN</td>
      <td>秩相关系数</td>
      <td>0.784677</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>0.05</td>
      <td>0.010</td>
    </tr>
    <tr>
      <th>2</th>
      <td>江苏</td>
      <td>12460.8</td>
      <td>2</td>
      <td>7405.82</td>
      <td>5</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>4</td>
      <td>1</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>3</th>
      <td>山东</td>
      <td>12435.9</td>
      <td>3</td>
      <td>9125</td>
      <td>2</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>5</td>
      <td>0.9</td>
      <td>1.000</td>
    </tr>
    <tr>
      <th>4</th>
      <td>浙江</td>
      <td>9395</td>
      <td>4</td>
      <td>4679.55</td>
      <td>11</td>
      <td>49</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>6</td>
      <td>0.829</td>
      <td>0.943</td>
    </tr>
    <tr>
      <th>5</th>
      <td>河北</td>
      <td>7098.56</td>
      <td>5</td>
      <td>6769.44</td>
      <td>6</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>7</td>
      <td>0.714</td>
      <td>0.893</td>
    </tr>
    <tr>
      <th>6</th>
      <td>河南</td>
      <td>7048.59</td>
      <td>6</td>
      <td>9667</td>
      <td>1</td>
      <td>25</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>8</td>
      <td>0.643</td>
      <td>0.833</td>
    </tr>
    <tr>
      <th>7</th>
      <td>上海</td>
      <td>6250.81</td>
      <td>7</td>
      <td>1711</td>
      <td>25</td>
      <td>324</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>9</td>
      <td>0.6</td>
      <td>0.783</td>
    </tr>
    <tr>
      <th>8</th>
      <td>辽宁</td>
      <td>6002.54</td>
      <td>8</td>
      <td>4210</td>
      <td>14</td>
      <td>36</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>10</td>
      <td>0.564</td>
      <td>0.746</td>
    </tr>
    <tr>
      <th>9</th>
      <td>四川</td>
      <td>5456.32</td>
      <td>9</td>
      <td>8700.4</td>
      <td>3</td>
      <td>36</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>12</td>
      <td>0.456</td>
      <td>0.712</td>
    </tr>
    <tr>
      <th>10</th>
      <td>湖北</td>
      <td>5401.71</td>
      <td>10</td>
      <td>6001.7</td>
      <td>9</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>14</td>
      <td>0.456</td>
      <td>0.645</td>
    </tr>
    <tr>
      <th>11</th>
      <td>福建</td>
      <td>5232.17</td>
      <td>11</td>
      <td>3488</td>
      <td>18</td>
      <td>49</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>16</td>
      <td>0.425</td>
      <td>0.601</td>
    </tr>
    <tr>
      <th>12</th>
      <td>湖南</td>
      <td>4638.73</td>
      <td>12</td>
      <td>6662.8</td>
      <td>7</td>
      <td>25</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>18</td>
      <td>0.399</td>
      <td>0.564</td>
    </tr>
    <tr>
      <th>13</th>
      <td>黑龙江</td>
      <td>4430</td>
      <td>13</td>
      <td>3815</td>
      <td>16</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>20</td>
      <td>0.377</td>
      <td>0.534</td>
    </tr>
    <tr>
      <th>14</th>
      <td>安徽</td>
      <td>3972.38</td>
      <td>14</td>
      <td>6410</td>
      <td>8</td>
      <td>36</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>22</td>
      <td>0.359</td>
      <td>0.508</td>
    </tr>
    <tr>
      <th>15</th>
      <td>北京</td>
      <td>3663.1</td>
      <td>15</td>
      <td>1456.4</td>
      <td>26</td>
      <td>121</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>24</td>
      <td>0.343</td>
      <td>0.485</td>
    </tr>
    <tr>
      <th>16</th>
      <td>江西</td>
      <td>2830.46</td>
      <td>16</td>
      <td>4254.23</td>
      <td>13</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>26</td>
      <td>0.329</td>
      <td>0.465</td>
    </tr>
    <tr>
      <th>17</th>
      <td>广西</td>
      <td>2735.13</td>
      <td>17</td>
      <td>4857</td>
      <td>10</td>
      <td>49</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>28</td>
      <td>0.317</td>
      <td>0.448</td>
    </tr>
    <tr>
      <th>18</th>
      <td>吉林</td>
      <td>2522.62</td>
      <td>18</td>
      <td>2703.7</td>
      <td>21</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>30</td>
      <td>0.306</td>
      <td>0.432</td>
    </tr>
    <tr>
      <th>19</th>
      <td>云南</td>
      <td>2465.29</td>
      <td>19</td>
      <td>4375.6</td>
      <td>12</td>
      <td>49</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>20</th>
      <td>山西</td>
      <td>2456.59</td>
      <td>20</td>
      <td>3314.29</td>
      <td>19</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>21</th>
      <td>天津</td>
      <td>2447.66</td>
      <td>21</td>
      <td>1011.3</td>
      <td>27</td>
      <td>36</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>22</th>
      <td>陕西</td>
      <td>2398.58</td>
      <td>22</td>
      <td>3689.5</td>
      <td>17</td>
      <td>25</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>23</th>
      <td>重庆</td>
      <td>2250.56</td>
      <td>23</td>
      <td>3130</td>
      <td>20</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>24</th>
      <td>内蒙古</td>
      <td>2150.41</td>
      <td>24</td>
      <td>2379.61</td>
      <td>23</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>25</th>
      <td>新疆</td>
      <td>1877.61</td>
      <td>25</td>
      <td>1933.95</td>
      <td>24</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>26</th>
      <td>贵州</td>
      <td>1356.11</td>
      <td>26</td>
      <td>3869.66</td>
      <td>15</td>
      <td>121</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>27</th>
      <td>甘肃</td>
      <td>1304.6</td>
      <td>27</td>
      <td>2603.34</td>
      <td>22</td>
      <td>25</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>28</th>
      <td>海南</td>
      <td>670.93</td>
      <td>28</td>
      <td>810.52</td>
      <td>28</td>
      <td>0</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>29</th>
      <td>青海</td>
      <td>390.21</td>
      <td>29</td>
      <td>533.8</td>
      <td>30</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>30</th>
      <td>宁夏</td>
      <td>385.34</td>
      <td>30</td>
      <td>580.3</td>
      <td>29</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>31</th>
      <td>西藏</td>
      <td>184.5</td>
      <td>31</td>
      <td>270.17</td>
      <td>31</td>
      <td>0</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>32</th>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>1068</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 自定义列名names</span></span><br><span class="line">data3 = pd.read_excel(<span class="string">'/home/Ubuntu/Documents/test.xlsx'</span>, <span class="number">2</span>, names=[<span class="number">1</span>,<span class="number">2</span>,<span class="number">3</span>,<span class="number">4</span>,<span class="number">5</span>,<span class="number">6</span>,<span class="number">7</span>,<span class="number">8</span>,<span class="number">9</span>,<span class="number">10</span>,<span class="number">11</span>,<span class="number">12</span>,<span class="number">13</span>])</span><br><span class="line">data3</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
      <th>4</th>
      <th>5</th>
      <th>6</th>
      <th>7</th>
      <th>8</th>
      <th>9</th>
      <th>10</th>
      <th>11</th>
      <th>12</th>
      <th>13</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>广东</td>
      <td>13625.866128</td>
      <td>1.0</td>
      <td>7954.22</td>
      <td>4.0</td>
      <td>9</td>
      <td>NaN</td>
      <td>秩相关系数</td>
      <td>0.784677</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>0.050</td>
      <td>0.010</td>
    </tr>
    <tr>
      <th>1</th>
      <td>江苏</td>
      <td>12460.830000</td>
      <td>2.0</td>
      <td>7405.82</td>
      <td>5.0</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>4.0</td>
      <td>1.000</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>2</th>
      <td>山东</td>
      <td>12435.930000</td>
      <td>3.0</td>
      <td>9125.00</td>
      <td>2.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>5.0</td>
      <td>0.900</td>
      <td>1.000</td>
    </tr>
    <tr>
      <th>3</th>
      <td>浙江</td>
      <td>9395.000000</td>
      <td>4.0</td>
      <td>4679.55</td>
      <td>11.0</td>
      <td>49</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>6.0</td>
      <td>0.829</td>
      <td>0.943</td>
    </tr>
    <tr>
      <th>4</th>
      <td>河北</td>
      <td>7098.560000</td>
      <td>5.0</td>
      <td>6769.44</td>
      <td>6.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>7.0</td>
      <td>0.714</td>
      <td>0.893</td>
    </tr>
    <tr>
      <th>5</th>
      <td>河南</td>
      <td>7048.590000</td>
      <td>6.0</td>
      <td>9667.00</td>
      <td>1.0</td>
      <td>25</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>8.0</td>
      <td>0.643</td>
      <td>0.833</td>
    </tr>
    <tr>
      <th>6</th>
      <td>上海</td>
      <td>6250.810000</td>
      <td>7.0</td>
      <td>1711.00</td>
      <td>25.0</td>
      <td>324</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>9.0</td>
      <td>0.600</td>
      <td>0.783</td>
    </tr>
    <tr>
      <th>7</th>
      <td>辽宁</td>
      <td>6002.540000</td>
      <td>8.0</td>
      <td>4210.00</td>
      <td>14.0</td>
      <td>36</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>10.0</td>
      <td>0.564</td>
      <td>0.746</td>
    </tr>
    <tr>
      <th>8</th>
      <td>四川</td>
      <td>5456.320000</td>
      <td>9.0</td>
      <td>8700.40</td>
      <td>3.0</td>
      <td>36</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>12.0</td>
      <td>0.456</td>
      <td>0.712</td>
    </tr>
    <tr>
      <th>9</th>
      <td>湖北</td>
      <td>5401.710000</td>
      <td>10.0</td>
      <td>6001.70</td>
      <td>9.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>14.0</td>
      <td>0.456</td>
      <td>0.645</td>
    </tr>
    <tr>
      <th>10</th>
      <td>福建</td>
      <td>5232.170000</td>
      <td>11.0</td>
      <td>3488.00</td>
      <td>18.0</td>
      <td>49</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>16.0</td>
      <td>0.425</td>
      <td>0.601</td>
    </tr>
    <tr>
      <th>11</th>
      <td>湖南</td>
      <td>4638.730000</td>
      <td>12.0</td>
      <td>6662.80</td>
      <td>7.0</td>
      <td>25</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>18.0</td>
      <td>0.399</td>
      <td>0.564</td>
    </tr>
    <tr>
      <th>12</th>
      <td>黑龙江</td>
      <td>4430.000000</td>
      <td>13.0</td>
      <td>3815.00</td>
      <td>16.0</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>20.0</td>
      <td>0.377</td>
      <td>0.534</td>
    </tr>
    <tr>
      <th>13</th>
      <td>安徽</td>
      <td>3972.380000</td>
      <td>14.0</td>
      <td>6410.00</td>
      <td>8.0</td>
      <td>36</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>22.0</td>
      <td>0.359</td>
      <td>0.508</td>
    </tr>
    <tr>
      <th>14</th>
      <td>北京</td>
      <td>3663.100000</td>
      <td>15.0</td>
      <td>1456.40</td>
      <td>26.0</td>
      <td>121</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>24.0</td>
      <td>0.343</td>
      <td>0.485</td>
    </tr>
    <tr>
      <th>15</th>
      <td>江西</td>
      <td>2830.460000</td>
      <td>16.0</td>
      <td>4254.23</td>
      <td>13.0</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>26.0</td>
      <td>0.329</td>
      <td>0.465</td>
    </tr>
    <tr>
      <th>16</th>
      <td>广西</td>
      <td>2735.130000</td>
      <td>17.0</td>
      <td>4857.00</td>
      <td>10.0</td>
      <td>49</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>28.0</td>
      <td>0.317</td>
      <td>0.448</td>
    </tr>
    <tr>
      <th>17</th>
      <td>吉林</td>
      <td>2522.620000</td>
      <td>18.0</td>
      <td>2703.70</td>
      <td>21.0</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>30.0</td>
      <td>0.306</td>
      <td>0.432</td>
    </tr>
    <tr>
      <th>18</th>
      <td>云南</td>
      <td>2465.290000</td>
      <td>19.0</td>
      <td>4375.60</td>
      <td>12.0</td>
      <td>49</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>19</th>
      <td>山西</td>
      <td>2456.590000</td>
      <td>20.0</td>
      <td>3314.29</td>
      <td>19.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>20</th>
      <td>天津</td>
      <td>2447.660000</td>
      <td>21.0</td>
      <td>1011.30</td>
      <td>27.0</td>
      <td>36</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>21</th>
      <td>陕西</td>
      <td>2398.580000</td>
      <td>22.0</td>
      <td>3689.50</td>
      <td>17.0</td>
      <td>25</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>22</th>
      <td>重庆</td>
      <td>2250.560000</td>
      <td>23.0</td>
      <td>3130.00</td>
      <td>20.0</td>
      <td>9</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>23</th>
      <td>内蒙古</td>
      <td>2150.414897</td>
      <td>24.0</td>
      <td>2379.61</td>
      <td>23.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>24</th>
      <td>新疆</td>
      <td>1877.610000</td>
      <td>25.0</td>
      <td>1933.95</td>
      <td>24.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>25</th>
      <td>贵州</td>
      <td>1356.110000</td>
      <td>26.0</td>
      <td>3869.66</td>
      <td>15.0</td>
      <td>121</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>26</th>
      <td>甘肃</td>
      <td>1304.600000</td>
      <td>27.0</td>
      <td>2603.34</td>
      <td>22.0</td>
      <td>25</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>27</th>
      <td>海南</td>
      <td>670.930000</td>
      <td>28.0</td>
      <td>810.52</td>
      <td>28.0</td>
      <td>0</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>28</th>
      <td>青海</td>
      <td>390.210000</td>
      <td>29.0</td>
      <td>533.80</td>
      <td>30.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>29</th>
      <td>宁夏</td>
      <td>385.340000</td>
      <td>30.0</td>
      <td>580.30</td>
      <td>29.0</td>
      <td>1</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>30</th>
      <td>西藏</td>
      <td>184.500000</td>
      <td>31.0</td>
      <td>270.17</td>
      <td>31.0</td>
      <td>0</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>31</th>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>1068</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>



<h2 id="2-2-数据筛选"><a href="#2-2-数据筛选" class="headerlink" title="2.2 数据筛选"></a>2.2 数据筛选</h2><pre><code>定位到某一区域</code></pre><h3 id="2-2-1-解析特定列usecols"><a href="#2-2-1-解析特定列usecols" class="headerlink" title="2.2.1 解析特定列usecols"></a>2.2.1 解析特定列usecols</h3><p>可传入 str、list</p>
<p>其中，</p>
<ol>
<li>如果是str，表示Excel列字母和列范围的列表（如：”A:E” 或 “A,C,E:F”)；</li>
<li>列表可以是字符串或整型，字符串表示列名称，整型表示列索引。</li>
</ol>
<p>注：解析特定行用nrows参数。</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">data4 = pd.read_excel(<span class="string">'/home/Ubuntu/Documents/test.xlsx'</span>, sheet_name=<span class="number">2</span>, usecols=[<span class="string">'GDP(x)(亿元)'</span>, <span class="string">'总人口(Y)(万人)'</span>])</span><br><span class="line">data4</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>GDP(x)(亿元)</th>
      <th>总人口(Y)(万人)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>13625.866128</td>
      <td>7954.22</td>
    </tr>
    <tr>
      <th>1</th>
      <td>12460.830000</td>
      <td>7405.82</td>
    </tr>
    <tr>
      <th>2</th>
      <td>12435.930000</td>
      <td>9125.00</td>
    </tr>
    <tr>
      <th>3</th>
      <td>9395.000000</td>
      <td>4679.55</td>
    </tr>
    <tr>
      <th>4</th>
      <td>7098.560000</td>
      <td>6769.44</td>
    </tr>
    <tr>
      <th>5</th>
      <td>7048.590000</td>
      <td>9667.00</td>
    </tr>
    <tr>
      <th>6</th>
      <td>6250.810000</td>
      <td>1711.00</td>
    </tr>
    <tr>
      <th>7</th>
      <td>6002.540000</td>
      <td>4210.00</td>
    </tr>
    <tr>
      <th>8</th>
      <td>5456.320000</td>
      <td>8700.40</td>
    </tr>
    <tr>
      <th>9</th>
      <td>5401.710000</td>
      <td>6001.70</td>
    </tr>
    <tr>
      <th>10</th>
      <td>5232.170000</td>
      <td>3488.00</td>
    </tr>
    <tr>
      <th>11</th>
      <td>4638.730000</td>
      <td>6662.80</td>
    </tr>
    <tr>
      <th>12</th>
      <td>4430.000000</td>
      <td>3815.00</td>
    </tr>
    <tr>
      <th>13</th>
      <td>3972.380000</td>
      <td>6410.00</td>
    </tr>
    <tr>
      <th>14</th>
      <td>3663.100000</td>
      <td>1456.40</td>
    </tr>
    <tr>
      <th>15</th>
      <td>2830.460000</td>
      <td>4254.23</td>
    </tr>
    <tr>
      <th>16</th>
      <td>2735.130000</td>
      <td>4857.00</td>
    </tr>
    <tr>
      <th>17</th>
      <td>2522.620000</td>
      <td>2703.70</td>
    </tr>
    <tr>
      <th>18</th>
      <td>2465.290000</td>
      <td>4375.60</td>
    </tr>
    <tr>
      <th>19</th>
      <td>2456.590000</td>
      <td>3314.29</td>
    </tr>
    <tr>
      <th>20</th>
      <td>2447.660000</td>
      <td>1011.30</td>
    </tr>
    <tr>
      <th>21</th>
      <td>2398.580000</td>
      <td>3689.50</td>
    </tr>
    <tr>
      <th>22</th>
      <td>2250.560000</td>
      <td>3130.00</td>
    </tr>
    <tr>
      <th>23</th>
      <td>2150.414897</td>
      <td>2379.61</td>
    </tr>
    <tr>
      <th>24</th>
      <td>1877.610000</td>
      <td>1933.95</td>
    </tr>
    <tr>
      <th>25</th>
      <td>1356.110000</td>
      <td>3869.66</td>
    </tr>
    <tr>
      <th>26</th>
      <td>1304.600000</td>
      <td>2603.34</td>
    </tr>
    <tr>
      <th>27</th>
      <td>670.930000</td>
      <td>810.52</td>
    </tr>
    <tr>
      <th>28</th>
      <td>390.210000</td>
      <td>533.80</td>
    </tr>
    <tr>
      <th>29</th>
      <td>385.340000</td>
      <td>580.30</td>
    </tr>
    <tr>
      <th>30</th>
      <td>184.500000</td>
      <td>270.17</td>
    </tr>
    <tr>
      <th>31</th>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
  </tbody>
</table>
</div>



<h3 id="2-2-2-跳过开头结尾的的行"><a href="#2-2-2-跳过开头结尾的的行" class="headerlink" title="2.2.2 跳过开头结尾的的行"></a>2.2.2 跳过开头结尾的的行</h3><p>  以哪行开始、以哪行结束  </p>
<p>skiprows：list-like  </p>
<ul>
<li>Rows to skip at the beginning (0-indexed).  </li>
</ul>
<p>skipfooterint, default 0  </p>
<ul>
<li>Rows at the end to skip (0-indexed).</li>
</ul>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">data5 = pd.read_excel(<span class="string">'/home/Ubuntu/Documents/test.xlsx'</span>, sheet_name=<span class="number">2</span>, usecols=[<span class="string">'GDP(x)(亿元)'</span>, <span class="string">'总人口(Y)(万人)'</span>], skipfooter=<span class="number">1</span>)</span><br><span class="line">data5</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>GDP(x)(亿元)</th>
      <th>总人口(Y)(万人)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>13625.866128</td>
      <td>7954.22</td>
    </tr>
    <tr>
      <th>1</th>
      <td>12460.830000</td>
      <td>7405.82</td>
    </tr>
    <tr>
      <th>2</th>
      <td>12435.930000</td>
      <td>9125.00</td>
    </tr>
    <tr>
      <th>3</th>
      <td>9395.000000</td>
      <td>4679.55</td>
    </tr>
    <tr>
      <th>4</th>
      <td>7098.560000</td>
      <td>6769.44</td>
    </tr>
    <tr>
      <th>5</th>
      <td>7048.590000</td>
      <td>9667.00</td>
    </tr>
    <tr>
      <th>6</th>
      <td>6250.810000</td>
      <td>1711.00</td>
    </tr>
    <tr>
      <th>7</th>
      <td>6002.540000</td>
      <td>4210.00</td>
    </tr>
    <tr>
      <th>8</th>
      <td>5456.320000</td>
      <td>8700.40</td>
    </tr>
    <tr>
      <th>9</th>
      <td>5401.710000</td>
      <td>6001.70</td>
    </tr>
    <tr>
      <th>10</th>
      <td>5232.170000</td>
      <td>3488.00</td>
    </tr>
    <tr>
      <th>11</th>
      <td>4638.730000</td>
      <td>6662.80</td>
    </tr>
    <tr>
      <th>12</th>
      <td>4430.000000</td>
      <td>3815.00</td>
    </tr>
    <tr>
      <th>13</th>
      <td>3972.380000</td>
      <td>6410.00</td>
    </tr>
    <tr>
      <th>14</th>
      <td>3663.100000</td>
      <td>1456.40</td>
    </tr>
    <tr>
      <th>15</th>
      <td>2830.460000</td>
      <td>4254.23</td>
    </tr>
    <tr>
      <th>16</th>
      <td>2735.130000</td>
      <td>4857.00</td>
    </tr>
    <tr>
      <th>17</th>
      <td>2522.620000</td>
      <td>2703.70</td>
    </tr>
    <tr>
      <th>18</th>
      <td>2465.290000</td>
      <td>4375.60</td>
    </tr>
    <tr>
      <th>19</th>
      <td>2456.590000</td>
      <td>3314.29</td>
    </tr>
    <tr>
      <th>20</th>
      <td>2447.660000</td>
      <td>1011.30</td>
    </tr>
    <tr>
      <th>21</th>
      <td>2398.580000</td>
      <td>3689.50</td>
    </tr>
    <tr>
      <th>22</th>
      <td>2250.560000</td>
      <td>3130.00</td>
    </tr>
    <tr>
      <th>23</th>
      <td>2150.414897</td>
      <td>2379.61</td>
    </tr>
    <tr>
      <th>24</th>
      <td>1877.610000</td>
      <td>1933.95</td>
    </tr>
    <tr>
      <th>25</th>
      <td>1356.110000</td>
      <td>3869.66</td>
    </tr>
    <tr>
      <th>26</th>
      <td>1304.600000</td>
      <td>2603.34</td>
    </tr>
    <tr>
      <th>27</th>
      <td>670.930000</td>
      <td>810.52</td>
    </tr>
    <tr>
      <th>28</th>
      <td>390.210000</td>
      <td>533.80</td>
    </tr>
    <tr>
      <th>29</th>
      <td>385.340000</td>
      <td>580.30</td>
    </tr>
    <tr>
      <th>30</th>
      <td>184.500000</td>
      <td>270.17</td>
    </tr>
  </tbody>
</table>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 计算 spearman 相关系数</span></span><br><span class="line">data5.corr(<span class="string">'spearman'</span>)</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>GDP(x)(亿元)</th>
      <th>总人口(Y)(万人)</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>GDP(x)(亿元)</th>
      <td>1.000000</td>
      <td>0.784677</td>
    </tr>
    <tr>
      <th>总人口(Y)(万人)</th>
      <td>0.784677</td>
      <td>1.000000</td>
    </tr>
  </tbody>
</table>
</div>



<h1 id="3-回归分析"><a href="#3-回归分析" class="headerlink" title="3 回归分析"></a>3 回归分析</h1><h2 id="3-1-一元线性回归"><a href="#3-1-一元线性回归" class="headerlink" title="3.1 一元线性回归"></a>3.1 一元线性回归</h2><p><strong>建立模型：</strong>  </p>
<ol>
<li><strong>选取</strong> 一元线性回归模型的 <strong>变量</strong> ；</li>
<li>绘制计算表和拟合散点图;</li>
<li>计算变量间的回归系数及其相关的显著性；</li>
<li>回归分析结果的应用。</li>
</ol>
<p><strong>模型的检验</strong>:  </p>
<ol>
<li>经济意义检验：就是根据模型中各个参数的经济含义，分析各参数的值是否与分析对象的经济含义相符；</li>
<li>回归标准差检验；</li>
<li>拟合优度检验；</li>
<li>回归系数的显著性检验。</li>
</ol>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> scipy <span class="keyword">import</span> stats</span><br><span class="line"><span class="keyword">import</span> matplotlib.pyplot <span class="keyword">as</span> plt</span><br><span class="line">%matplotlib inline</span><br><span class="line">%config InlineBackend.figure_format = <span class="string">'svg'</span>  <span class="comment"># 转化成矢量图，提高清晰度</span></span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 完整sheet在pandas中查看</span></span><br><span class="line">data6 = pd.read_excel(<span class="string">'/home/Ubuntu/Documents/test.xlsx'</span>, sheet_name=<span class="number">1</span>)</span><br><span class="line">data6</span><br></pre></td></tr></table></figure>




<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

<pre><code>.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}</code></pre><p></style><p></p>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>台站</th>
      <th>经度x/度</th>
      <th>纬度y/度</th>
      <th>海拔a/m</th>
      <th>年降水量p/mm</th>
      <th>年蒸发量v/mm</th>
      <th>Unnamed: 6</th>
      <th>Unnamed: 7</th>
      <th>相关系数</th>
      <th>Unnamed: 9</th>
      <th>Unnamed: 10</th>
      <th>Unnamed: 11</th>
      <th>Unnamed: 12</th>
      <th>Unnamed: 13</th>
      <th>Unnamed: 14</th>
      <th>Unnamed: 15</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>0</th>
      <td>安西</td>
      <td>95.92</td>
      <td>40.50</td>
      <td>1170.8</td>
      <td>48.25</td>
      <td>2835.57</td>
      <td>NaN</td>
      <td>py</td>
      <td>-0.903529</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>1</th>
      <td>白银</td>
      <td>104.53</td>
      <td>36.60</td>
      <td>1707.2</td>
      <td>193.72</td>
      <td>1947.97</td>
      <td>NaN</td>
      <td>vy</td>
      <td>0.880732</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>2</th>
      <td>定西</td>
      <td>104.63</td>
      <td>35.53</td>
      <td>1908.8</td>
      <td>413.94</td>
      <td>1538.10</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>3</th>
      <td>古浪</td>
      <td>102.90</td>
      <td>37.48</td>
      <td>2072.4</td>
      <td>358.60</td>
      <td>1756.79</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>4</th>
      <td>和政</td>
      <td>103.35</td>
      <td>35.43</td>
      <td>2136.4</td>
      <td>615.04</td>
      <td>1317.64</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>...</th>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
      <td>...</td>
    </tr>
    <tr>
      <th>57</th>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
    </tr>
    <tr>
      <th>58</th>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>Coefficients</td>
      <td>标准误差</td>
      <td>t Stat</td>
      <td>P-value</td>
      <td>Lower 95%</td>
      <td>Upper 95%</td>
      <td>下限 95.0%</td>
      <td>上限 95.0%</td>
    </tr>
    <tr>
      <th>59</th>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>Intercept</td>
      <td>3295.13</td>
      <td>205.455</td>
      <td>16.0382</td>
      <td>2.37198e-21</td>
      <td>2882.46</td>
      <td>3707.8</td>
      <td>2882.46</td>
      <td>3707.8</td>
    </tr>
    <tr>
      <th>60</th>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>X Variable 1</td>
      <td>-81.1737</td>
      <td>5.38605</td>
      <td>-15.0711</td>
      <td>3.15159e-20</td>
      <td>-91.9919</td>
      <td>-70.3555</td>
      <td>-91.9919</td>
      <td>-70.3555</td>
    </tr>
    <tr>
      <th>61</th>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>NaN</td>
      <td>X Variable 2</td>
      <td>0.036214</td>
      <td>0.0208951</td>
      <td>1.73313</td>
      <td>0.0892358</td>
      <td>-0.00575503</td>
      <td>0.078183</td>
      <td>-0.00575503</td>
      <td>0.078183</td>
    </tr>
  </tbody>
</table>
<p>62 rows × 16 columns</p>
</div>




<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 数据筛选</span></span><br><span class="line">data7 = pd.read_excel(<span class="string">'/home/Ubuntu/Documents/test.xlsx'</span>, sheet_name=<span class="number">1</span>, usecols=[<span class="string">'纬度y/度'</span>, <span class="string">'年降水量p/mm'</span>], skipfooter=<span class="number">9</span>)</span><br><span class="line"><span class="comment"># 观察前后五行</span></span><br><span class="line">print(data7.head(<span class="number">5</span>))</span><br><span class="line">print(data7.tail(<span class="number">5</span>))</span><br></pre></td></tr></table></figure>

<pre><code>   纬度y/度  年降水量p/mm
0  40.50     48.25
1  36.60    193.72
2  35.53    413.94
3  37.48    358.60
4  35.43    615.04
    纬度y/度  年降水量p/mm
48  34.70    515.02
49  35.00    545.72
50  34.21    786.75
51  35.43    584.89
52  36.14    574.00</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 散点图观察趋势</span></span><br><span class="line">plt.scatter(</span><br><span class="line">    data7[<span class="string">'纬度y/度'</span>],</span><br><span class="line">    data7[<span class="string">'年降水量p/mm'</span>],</span><br><span class="line">)</span><br><span class="line">plt.xlabel(<span class="string">'latitud'</span>)</span><br><span class="line">plt.ylabel(<span class="string">'amount of precipitation'</span>)</span><br></pre></td></tr></table></figure>




<pre><code>Text(0, 0.5, &apos;amount of precipitation&apos;)</code></pre><p><img src="/.io//QG%E5%AE%9E%E9%AA%8C2-%E7%BB%8F%E5%85%B8%E7%BB%9F%E8%AE%A1%E5%88%86%E6%9E%901%EF%BC%88Excel%E3%80%81Python%29_19_1.svg" alt="svg"></p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 计算参数</span></span><br><span class="line">x = data7[<span class="string">'纬度y/度'</span>].values</span><br><span class="line">y = data7[<span class="string">'年降水量p/mm'</span>].values</span><br><span class="line"></span><br><span class="line"><span class="comment">#############参数说明#############</span></span><br><span class="line"><span class="comment"># slope：斜率                    #</span></span><br><span class="line"><span class="comment"># intercept：截距                #</span></span><br><span class="line"><span class="comment"># r_value：相关系数              #</span></span><br><span class="line"><span class="comment"># p_value：假设检验P值           #</span></span><br><span class="line"><span class="comment"># sts_err：标准误差              #</span></span><br><span class="line"><span class="comment">##################################</span></span><br><span class="line"></span><br><span class="line">slope, intercept, r_value, p_value, std_err = stats.linregress(x,y)</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 曲线拟合</span></span><br><span class="line">plt.scatter(</span><br><span class="line">    data7[<span class="string">'纬度y/度'</span>],</span><br><span class="line">    data7[<span class="string">'年降水量p/mm'</span>],</span><br><span class="line">)</span><br><span class="line"></span><br><span class="line">predictions = slope*data7[<span class="string">'纬度y/度'</span>] + intercept</span><br><span class="line">plt.plot(</span><br><span class="line">    data7[<span class="string">'纬度y/度'</span>],</span><br><span class="line">    predictions,</span><br><span class="line">    c=<span class="string">'black'</span>,</span><br><span class="line">    linewidth=<span class="number">2</span></span><br><span class="line">)</span><br><span class="line">plt.xlabel(<span class="string">'纬度y/度'</span>)</span><br><span class="line">plt.ylabel(<span class="string">'年降水量p/mm'</span>)</span><br></pre></td></tr></table></figure>




<pre><code>Text(0, 0.5, &apos;年降水量p/mm&apos;)</code></pre><p><img src="/.io//QG%E5%AE%9E%E9%AA%8C2-%E7%BB%8F%E5%85%B8%E7%BB%9F%E8%AE%A1%E5%88%86%E6%9E%901%EF%BC%88Excel%E3%80%81Python%29_21_1.svg" alt="svg"></p>
<p><strong>显著性检验参数有：</strong>   </p>
<ol>
<li>回归系数检验（t-检验）</li>
<li>拟合优度R<sup>2</sup></li>
<li>模型检验(F检验）</li>
</ol>
<p>在一元线性回归分析中，三者可以转化、检验效果基本一致。</p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 显著性检验 R²</span></span><br><span class="line">print(<span class="string">"The linear model is: y = &#123;:.5&#125;x + &#123;:.5&#125;"</span>.format(slope, intercept))</span><br><span class="line">print(<span class="string">"r-squared:"</span>, r_value**<span class="number">2</span>)</span><br></pre></td></tr></table></figure>

<pre><code>The linear model is: y = -82.188x + 3395.6
r-squared: 0.8163651594029047</code></pre><p><strong>补充：</strong><br>Python实现一元线性回归的8种方法：</p>
<ol>
<li>Simple matrix inverse;</li>
<li>Stats.linregress;</li>
<li>Numpy.linalg.lstsq;</li>
<li>Moore-Penrose inverse;</li>
<li>sklearn.linear_model;</li>
<li>Polyfit;</li>
<li>Statsmodels.OLS;</li>
<li>Optimize.curve_fit。</li>
</ol>
<p>排名按速度快慢的顺序，其中Statsmodels.OLS()结果像R或Julia等统计语言一样丰富。所以你也可以搭配使用，你可以用sklearn。linalg_model来进行训练预测，用statsmodel.OLS来进行模型评估的。</p>
<p>参考文章：<br><a href="https://blog.csdn.net/tMb8Z9Vdm66wH68VX1/article/details/79102425" target="_blank" rel="noopener">https://blog.csdn.net/tMb8Z9Vdm66wH68VX1/article/details/79102425</a><br>原文地址：<br><a href="https://medium.freecodecamp.org/data-science-with-python-8-ways-to-do-linear-regression-and-measure-their-speed-b5577d75f8b" target="_blank" rel="noopener">https://medium.freecodecamp.org/data-science-with-python-8-ways-to-do-linear-regression-and-measure-their-speed-b5577d75f8b</a>  </p>
<h2 id="3-2-多元线性分析"><a href="#3-2-多元线性分析" class="headerlink" title="3.2 多元线性分析"></a>3.2 多元线性分析</h2><p>多元与一元基本一致，基本过程有选取变量、建模、检验。  </p>
<p><strong>Tip：</strong> 进行多元线性回归分析时就不能再用Stats.linregress了，它只能进行一元线性回归分析。进行多元线性回归以及非线性关系的线性化都可以用sklearn.linear_modle，<a href="https://scikit-learn.org/stable/modules/classes.html#module-sklearn.linear_model" target="_blank" rel="noopener">API参考</a></p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">from</span> sklearn <span class="keyword">import</span> linear_model</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"><span class="comment"># 数据清洗</span></span><br><span class="line">data8 = pd.read_excel(<span class="string">'/home/Ubuntu/Documents/test.xlsx'</span>, sheet_name=<span class="number">1</span>, usecols=[<span class="string">'纬度y/度'</span>, <span class="string">'海拔a/m'</span>, <span class="string">'年降水量p/mm'</span>], skipfooter=<span class="number">9</span>)</span><br><span class="line"><span class="comment"># 清洗结果查看</span></span><br><span class="line">print(data8.head())</span><br><span class="line">print(data8.tail())</span><br></pre></td></tr></table></figure>

<pre><code>   纬度y/度   海拔a/m  年降水量p/mm
0  40.50  1170.8     48.25
1  36.60  1707.2    193.72
2  35.53  1908.8    413.94
3  37.48  2072.4    358.60
4  35.43  2136.4    615.04
    纬度y/度   海拔a/m  年降水量p/mm
48  34.70  2810.2    515.02
49  35.00  2915.7    545.72
50  34.21  3362.7    786.75
51  35.43  1221.2    584.89
52  36.14  1111.7    574.00</code></pre><figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 选取变量</span></span><br><span class="line">x = data8.drop([<span class="string">'年降水量p/mm'</span>], axis=<span class="number">1</span>)</span><br><span class="line">y = data8.drop([<span class="string">'纬度y/度'</span>, <span class="string">'海拔a/m'</span>], axis=<span class="number">1</span>)</span><br></pre></td></tr></table></figure>


<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># 创建线性回归对象</span></span><br><span class="line">regr = linear_model.LinearRegression()</span><br><span class="line"></span><br><span class="line"><span class="comment"># 使用数据训练模型</span></span><br><span class="line">regr.fit(x, y)</span><br><span class="line"></span><br><span class="line"><span class="comment"># 拟合模型</span></span><br><span class="line">print(<span class="string">"The linear model is: Y = &#123;:.5&#125; + &#123;:.5&#125;*维度 + &#123;:.5&#125;*海拔"</span>.format(regr.intercept_[<span class="number">0</span>], regr.coef_[<span class="number">0</span>][<span class="number">0</span>], regr.coef_[<span class="number">0</span>][<span class="number">1</span>]))</span><br></pre></td></tr></table></figure>

<pre><code>The linear model is: Y = 3295.1 + -81.174*维度 + 0.036214*海拔</code></pre><p>之后，可以直接调用regr实例的Methods，获取想要的相关数据：</p>
<ol>
<li>get_params()   获取预测（计算模型用的）参数  </li>
<li>predict()     获取预测值</li>
<li>score()       可决系数R<sup>2<sup></sup></sup></li>
</ol>
<p>标准误差可以用sklearn.metrics.mean_squared_error()获取    </p>
<p><strong>再者:</strong> 如果需要更多参数可以使用statsmodel库，也一样几行代码完成回归计算。<a href="https://www.statsmodels.org/stable/api.html" target="_blank" rel="noopener">statsmodel库API</a></p>
<figure class="highlight python"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">import</span> statsmodels.api <span class="keyword">as</span> sm</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">X2 = sm.add_constant(x)</span><br><span class="line">regr1 = sm.OLS(y, X2).fit()</span><br><span class="line"><span class="comment"># 总结</span></span><br><span class="line">regr1.summary()</span><br></pre></td></tr></table></figure>




<table class="simpletable">
<caption>OLS Regression Results</caption>
<tr>
  <th>Dep. Variable:</th>        <td>年降水量p/mm</td>     <th>  R-squared:         </th> <td>   0.827</td>
</tr>
<tr>
  <th>Model:</th>                   <td>OLS</td>       <th>  Adj. R-squared:    </th> <td>   0.820</td>
</tr>
<tr>
  <th>Method:</th>             <td>Least Squares</td>  <th>  F-statistic:       </th> <td>   119.3</td>
</tr>
<tr>
  <th>Date:</th>             <td>Tue, 12 May 2020</td> <th>  Prob (F-statistic):</th> <td>9.24e-20</td>
</tr>
<tr>
  <th>Time:</th>                 <td>16:49:37</td>     <th>  Log-Likelihood:    </th> <td> -312.86</td>
</tr>
<tr>
  <th>No. Observations:</th>      <td>    53</td>      <th>  AIC:               </th> <td>   631.7</td>
</tr>
<tr>
  <th>Df Residuals:</th>          <td>    50</td>      <th>  BIC:               </th> <td>   637.6</td>
</tr>
<tr>
  <th>Df Model:</th>              <td>     2</td>      <th>                     </th>     <td> </td>   
</tr>
<tr>
  <th>Covariance Type:</th>      <td>nonrobust</td>    <th>                     </th>     <td> </td>   
</tr>
</table>
<table class="simpletable">
<tr>
    <td></td>       <th>coef</th>     <th>std err</th>      <th>t</th>      <th>P>|t|</th>  <th>[0.025</th>    <th>0.975]</th>  
</tr>
<tr>
  <th>const</th> <td> 3295.1279</td> <td>  205.455</td> <td>   16.038</td> <td> 0.000</td> <td> 2882.460</td> <td> 3707.796</td>
</tr>
<tr>
  <th>纬度y/度</th> <td>  -81.1737</td> <td>    5.386</td> <td>  -15.071</td> <td> 0.000</td> <td>  -91.992</td> <td>  -70.355</td>
</tr>
<tr>
  <th>海拔a/m</th> <td>    0.0362</td> <td>    0.021</td> <td>    1.733</td> <td> 0.089</td> <td>   -0.006</td> <td>    0.078</td>
</tr>
</table>
<table class="simpletable">
<tr>
  <th>Omnibus:</th>       <td> 1.809</td> <th>  Durbin-Watson:     </th> <td>   1.347</td>
</tr>
<tr>
  <th>Prob(Omnibus):</th> <td> 0.405</td> <th>  Jarque-Bera (JB):  </th> <td>   1.677</td>
</tr>
<tr>
  <th>Skew:</th>          <td> 0.330</td> <th>  Prob(JB):          </th> <td>   0.432</td>
</tr>
<tr>
  <th>Kurtosis:</th>      <td> 2.431</td> <th>  Cond. No.          </th> <td>3.03e+04</td>
</tr>
</table><br><br>Warnings:<br>[1] Standard Errors assume that the covariance matrix of the errors is correctly specified.<br>[2] The condition number is large, 3.03e+04. This might indicate that there are<br>strong multicollinearity or other numerical problems.
      
    </div>
    
    
    

    <div>
      
        
      
    </div>

    <div>
      
        <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束<i class="fa fa-paw"></i>感谢您的阅读-------------</div>
    
</div>
      
    </div>
    

    

    

    

    <footer class="post-footer">
      

      
      
        <div class="post-widgets">
        

        

        
          
          <div id="needsharebutton-postbottom">
            <span class="btn">
              <i class="fa fa-share-alt" aria-hidden="true"></i>
            </span>
          </div>
        
        </div>
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2020/04/21/RS02-Evaluation_of_image_fusion/" rel="next" title="图像融合质量评价指标">
                <i class="fa fa-chevron-left"></i> 图像融合质量评价指标
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2020/05/13/test/" rel="prev" title="test">
                test <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
    </div>
  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/images/avatar.jpg"
                alt="一线毛衣" />
            
              <p class="site-author-name" itemprop="name">一线毛衣</p>
              <p class="site-description motion-element" itemprop="description">这里有Python、GIS相关的小笔记！</p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/%7C%7C%20archive">
              
                  <span class="site-state-item-count">7</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">5</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">11</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          
            <div class="links-of-author motion-element">
                
                  <span class="links-of-author-item">
                    <a href="https://github.com/rsweater" target="_blank" title="GitHub">
                      
                        <i class="fa fa-fw fa-github"></i>GitHub</a>
                  </span>
                
                  <span class="links-of-author-item">
                    <a href="mailto:bw_chen1223@foxmail.com" target="_blank" title="E-Mail">
                      
                        <i class="fa fa-fw fa-envelope"></i>E-Mail</a>
                  </span>
                
            </div>
          

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#1-相关分析——Spearman、Pearson系数"><span class="nav-number">1.</span> <span class="nav-text">1 相关分析——Spearman、Pearson系数</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#2-pandas——read-excel"><span class="nav-number">2.</span> <span class="nav-text">2 pandas——read_excel</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#2-1-数据准备"><span class="nav-number">2.1.</span> <span class="nav-text">2.1 数据准备</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#2-2-数据筛选"><span class="nav-number">2.2.</span> <span class="nav-text">2.2 数据筛选</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-1-解析特定列usecols"><span class="nav-number">2.2.1.</span> <span class="nav-text">2.2.1 解析特定列usecols</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#2-2-2-跳过开头结尾的的行"><span class="nav-number">2.2.2.</span> <span class="nav-text">2.2.2 跳过开头结尾的的行</span></a></li></ol></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#3-回归分析"><span class="nav-number">3.</span> <span class="nav-text">3 回归分析</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#3-1-一元线性回归"><span class="nav-number">3.1.</span> <span class="nav-text">3.1 一元线性回归</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#3-2-多元线性分析"><span class="nav-number">3.2.</span> <span class="nav-text">3.2 多元线性分析</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      
        <div class="back-to-top">
          <i class="fa fa-arrow-up"></i>
          
            <span id="scrollpercent"><span>0</span>%</span>
          
        </div>
      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">一线毛衣</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>




<div class="theme-info">
  <div class="powered-by"></div>
  <span class="post-count">博客全站共7.6k字</span>
</div>
        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  

  
</div>





  <script type="text/javascript">
    (function() {
      var hm = document.createElement("script");
      hm.src = "//tajs.qq.com/stats?sId=66540970";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




        
      </div>
    </footer>

    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  




  
  









  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  

  
  
    <script type="text/javascript" src="/lib/three/three.min.js"></script>
  

  
  
    <script type="text/javascript" src="/lib/three/three-waves.min.js"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.4"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.4"></script>



  
  

  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.4"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.4"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.4"></script>



  


  




	





  





  










  <script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
  <script src="//unpkg.com/valine/dist/Valine.min.js"></script>
  
  <script type="text/javascript">
    var GUEST = ['nick','mail','link'];
    var guest = 'nick,mail,link';
    guest = guest.split(',').filter(item=>{
      return GUEST.indexOf(item)>-1;
    });
    new Valine({
        el: '#comments' ,
        verify: false,
        notify: false,
        appId: 'n0m507S9Q3hGB7na3rXQO8bH-gzGzoHsz',
        appKey: 'nBz9lyUQ5ooRmJcE8qaIVUym',
        placeholder: 'ヾﾉ≧∀≦)o来啊，快活啊!',
        avatar:'mm',
        guest_info:guest,
        pageSize:'10' || 10,
    });
  </script>



  

  <script type="text/javascript">
    // Popup Window;
    var isfetched = false;
    var isXml = true;
    // Search DB path;
    var search_path = "search.xml";
    if (search_path.length === 0) {
      search_path = "search.xml";
    } else if (/json$/i.test(search_path)) {
      isXml = false;
    }
    var path = "/" + search_path;
    // monitor main search box;

    var onPopupClose = function (e) {
      $('.popup').hide();
      $('#local-search-input').val('');
      $('.search-result-list').remove();
      $('#no-result').remove();
      $(".local-search-pop-overlay").remove();
      $('body').css('overflow', '');
    }

    function proceedsearch() {
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay"></div>')
        .css('overflow', 'hidden');
      $('.search-popup-overlay').click(onPopupClose);
      $('.popup').toggle();
      var $localSearchInput = $('#local-search-input');
      $localSearchInput.attr("autocapitalize", "none");
      $localSearchInput.attr("autocorrect", "off");
      $localSearchInput.focus();
    }

    // search function;
    var searchFunc = function(path, search_id, content_id) {
      'use strict';

      // start loading animation
      $("body")
        .append('<div class="search-popup-overlay local-search-pop-overlay">' +
          '<div id="search-loading-icon">' +
          '<i class="fa fa-spinner fa-pulse fa-5x fa-fw"></i>' +
          '</div>' +
          '</div>')
        .css('overflow', 'hidden');
      $("#search-loading-icon").css('margin', '20% auto 0 auto').css('text-align', 'center');

      $.ajax({
        url: path,
        dataType: isXml ? "xml" : "json",
        async: true,
        success: function(res) {
          // get the contents from search data
          isfetched = true;
          $('.popup').detach().appendTo('.header-inner');
          var datas = isXml ? $("entry", res).map(function() {
            return {
              title: $("title", this).text(),
              content: $("content",this).text(),
              url: $("url" , this).text()
            };
          }).get() : res;
          var input = document.getElementById(search_id);
          var resultContent = document.getElementById(content_id);
          var inputEventFunction = function() {
            var searchText = input.value.trim().toLowerCase();
            var keywords = searchText.split(/[\s\-]+/);
            if (keywords.length > 1) {
              keywords.push(searchText);
            }
            var resultItems = [];
            if (searchText.length > 0) {
              // perform local searching
              datas.forEach(function(data) {
                var isMatch = false;
                var hitCount = 0;
                var searchTextCount = 0;
                var title = data.title.trim();
                var titleInLowerCase = title.toLowerCase();
                var content = data.content.trim().replace(/<[^>]+>/g,"");
                var contentInLowerCase = content.toLowerCase();
                var articleUrl = decodeURIComponent(data.url);
                var indexOfTitle = [];
                var indexOfContent = [];
                // only match articles with not empty titles
                if(title != '') {
                  keywords.forEach(function(keyword) {
                    function getIndexByWord(word, text, caseSensitive) {
                      var wordLen = word.length;
                      if (wordLen === 0) {
                        return [];
                      }
                      var startPosition = 0, position = [], index = [];
                      if (!caseSensitive) {
                        text = text.toLowerCase();
                        word = word.toLowerCase();
                      }
                      while ((position = text.indexOf(word, startPosition)) > -1) {
                        index.push({position: position, word: word});
                        startPosition = position + wordLen;
                      }
                      return index;
                    }

                    indexOfTitle = indexOfTitle.concat(getIndexByWord(keyword, titleInLowerCase, false));
                    indexOfContent = indexOfContent.concat(getIndexByWord(keyword, contentInLowerCase, false));
                  });
                  if (indexOfTitle.length > 0 || indexOfContent.length > 0) {
                    isMatch = true;
                    hitCount = indexOfTitle.length + indexOfContent.length;
                  }
                }

                // show search results

                if (isMatch) {
                  // sort index by position of keyword

                  [indexOfTitle, indexOfContent].forEach(function (index) {
                    index.sort(function (itemLeft, itemRight) {
                      if (itemRight.position !== itemLeft.position) {
                        return itemRight.position - itemLeft.position;
                      } else {
                        return itemLeft.word.length - itemRight.word.length;
                      }
                    });
                  });

                  // merge hits into slices

                  function mergeIntoSlice(text, start, end, index) {
                    var item = index[index.length - 1];
                    var position = item.position;
                    var word = item.word;
                    var hits = [];
                    var searchTextCountInSlice = 0;
                    while (position + word.length <= end && index.length != 0) {
                      if (word === searchText) {
                        searchTextCountInSlice++;
                      }
                      hits.push({position: position, length: word.length});
                      var wordEnd = position + word.length;

                      // move to next position of hit

                      index.pop();
                      while (index.length != 0) {
                        item = index[index.length - 1];
                        position = item.position;
                        word = item.word;
                        if (wordEnd > position) {
                          index.pop();
                        } else {
                          break;
                        }
                      }
                    }
                    searchTextCount += searchTextCountInSlice;
                    return {
                      hits: hits,
                      start: start,
                      end: end,
                      searchTextCount: searchTextCountInSlice
                    };
                  }

                  var slicesOfTitle = [];
                  if (indexOfTitle.length != 0) {
                    slicesOfTitle.push(mergeIntoSlice(title, 0, title.length, indexOfTitle));
                  }

                  var slicesOfContent = [];
                  while (indexOfContent.length != 0) {
                    var item = indexOfContent[indexOfContent.length - 1];
                    var position = item.position;
                    var word = item.word;
                    // cut out 100 characters
                    var start = position - 20;
                    var end = position + 80;
                    if(start < 0){
                      start = 0;
                    }
                    if (end < position + word.length) {
                      end = position + word.length;
                    }
                    if(end > content.length){
                      end = content.length;
                    }
                    slicesOfContent.push(mergeIntoSlice(content, start, end, indexOfContent));
                  }

                  // sort slices in content by search text's count and hits' count

                  slicesOfContent.sort(function (sliceLeft, sliceRight) {
                    if (sliceLeft.searchTextCount !== sliceRight.searchTextCount) {
                      return sliceRight.searchTextCount - sliceLeft.searchTextCount;
                    } else if (sliceLeft.hits.length !== sliceRight.hits.length) {
                      return sliceRight.hits.length - sliceLeft.hits.length;
                    } else {
                      return sliceLeft.start - sliceRight.start;
                    }
                  });

                  // select top N slices in content

                  var upperBound = parseInt('1');
                  if (upperBound >= 0) {
                    slicesOfContent = slicesOfContent.slice(0, upperBound);
                  }

                  // highlight title and content

                  function highlightKeyword(text, slice) {
                    var result = '';
                    var prevEnd = slice.start;
                    slice.hits.forEach(function (hit) {
                      result += text.substring(prevEnd, hit.position);
                      var end = hit.position + hit.length;
                      result += '<b class="search-keyword">' + text.substring(hit.position, end) + '</b>';
                      prevEnd = end;
                    });
                    result += text.substring(prevEnd, slice.end);
                    return result;
                  }

                  var resultItem = '';

                  if (slicesOfTitle.length != 0) {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + highlightKeyword(title, slicesOfTitle[0]) + "</a>";
                  } else {
                    resultItem += "<li><a href='" + articleUrl + "' class='search-result-title'>" + title + "</a>";
                  }

                  slicesOfContent.forEach(function (slice) {
                    resultItem += "<a href='" + articleUrl + "'>" +
                      "<p class=\"search-result\">" + highlightKeyword(content, slice) +
                      "...</p>" + "</a>";
                  });

                  resultItem += "</li>";
                  resultItems.push({
                    item: resultItem,
                    searchTextCount: searchTextCount,
                    hitCount: hitCount,
                    id: resultItems.length
                  });
                }
              })
            };
            if (keywords.length === 1 && keywords[0] === "") {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-search fa-5x" /></div>'
            } else if (resultItems.length === 0) {
              resultContent.innerHTML = '<div id="no-result"><i class="fa fa-frown-o fa-5x" /></div>'
            } else {
              resultItems.sort(function (resultLeft, resultRight) {
                if (resultLeft.searchTextCount !== resultRight.searchTextCount) {
                  return resultRight.searchTextCount - resultLeft.searchTextCount;
                } else if (resultLeft.hitCount !== resultRight.hitCount) {
                  return resultRight.hitCount - resultLeft.hitCount;
                } else {
                  return resultRight.id - resultLeft.id;
                }
              });
              var searchResultList = '<ul class=\"search-result-list\">';
              resultItems.forEach(function (result) {
                searchResultList += result.item;
              })
              searchResultList += "</ul>";
              resultContent.innerHTML = searchResultList;
            }
          }

          if ('auto' === 'auto') {
            input.addEventListener('input', inputEventFunction);
          } else {
            $('.search-icon').click(inputEventFunction);
            input.addEventListener('keypress', function (event) {
              if (event.keyCode === 13) {
                inputEventFunction();
              }
            });
          }

          // remove loading animation
          $(".local-search-pop-overlay").remove();
          $('body').css('overflow', '');

          proceedsearch();
        }
      });
    }

    // handle and trigger popup window;
    $('.popup-trigger').click(function(e) {
      e.stopPropagation();
      if (isfetched === false) {
        searchFunc(path, 'local-search-input', 'local-search-result');
      } else {
        proceedsearch();
      };
    });

    $('.popup-btn-close').click(onPopupClose);
    $('.popup').click(function(e){
      e.stopPropagation();
    });
    $(document).on('keyup', function (event) {
      var shouldDismissSearchPopup = event.which === 27 &&
        $('.search-popup').is(':visible');
      if (shouldDismissSearchPopup) {
        onPopupClose();
      }
    });
  </script>





  

  

  
<script>
(function(){
    var bp = document.createElement('script');
    var curProtocol = window.location.protocol.split(':')[0];
    if (curProtocol === 'https') {
        bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';        
    }
    else {
        bp.src = 'http://push.zhanzhang.baidu.com/push.js';
    }
    var s = document.getElementsByTagName("script")[0];
    s.parentNode.insertBefore(bp, s);
})();
</script>


  
  
  
  <link rel="stylesheet" href="/lib/needsharebutton/needsharebutton.css">

  
  
  <script src="/lib/needsharebutton/needsharebutton.js"></script>

  <script>
    
      pbOptions = {};
      
          pbOptions.iconStyle = "box";
      
          pbOptions.boxForm = "horizontal";
      
          pbOptions.position = "bottomCenter";
      
          pbOptions.networks = "Weibo,Wechat,Douban,QQZone,Twitter,Facebook";
      
      new needShareButton('#needsharebutton-postbottom', pbOptions);
    
    
  </script>

  

  
  


  

  

  
<!-- 代码块复制功能 -->
<script type="text/javascript" src="/js/src/clipboard.min.js"></script>  
<script type="text/javascript" src="/js/src/clipboard-use.js"></script>

<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","model":{"jsonPath":"live2d-widget-model-wanko"},"display":{"position":"right","width":150,"height":300},"mobile":{"show":true},"log":false,"tagMode":false});</script></body>
</html>
